class AsteroidPelem: public Asteroid
{
public:
  double ap;
  double ep;
  double sinip;
 
  long familyMilani;
  long familyDavidN;

  double Cj; /* NOTE FROM DAVID N    C_j = 10^(-H_j/5) (a_j - a_center)/C_0,                               
        H is the absolute magnitude,                                          
        a is the proper semimajor axis of a member,                           
        a_center is the family center,                                        
        C_0 is the best fit to the V-shape envelope of the family,            
        and index j runs over individual bodies. Bodies with |C_j|>1 are      
        suspected to be dynamical interlopers. See Nesvorny et al. (2015) for 
        further discussion of the C parameter."                  
	     */
  AsteroidPelem():Asteroid()
  {
    familyMilani=familyDavidN=ap=ep=sinip=0;
  };

  AsteroidPelem(string line):Asteroid()
  {
    ap=ep=sinip=0;
    SYNstring2propElem(line);
  };

  void SYNstring2propElem(string line)
  {
    char* write = this->Designation;
    int j=0;

    do {
      // find if there is a caracter. 
      if ((line[j] <= 'z' && line[j] >= 'a') || (line[j] <= 'Z' && line[j] >= 'A'))
	Number=-1; // then set number to -1
      if (line[j] != ' ')
	*write++ = line[j];
    } while ((line[j++]) && (j<10));
    *write=0;

    ap=atof(&line.at(16));
    ep=atof(&line.at(29));
    sinip=atof(&line.at(39));

    if (Number != -1)
      {
        Number = atol(Designation);
        number2pack();
      } else
      {
        designation2pack();
      }
/*
    if (Number == -1)
      {
        cout << line << endl;
        cout << Designation << endl;
      }
*/
  };

  void uFITstring2propElem(string line)
  {
    sscanf(&line.at(0), "%s %lf %lf %lf",Designation,&ap,&ep,&sinip);
    designation2pack();
  };

  void AllNUMstring2propElem(string line)
  {
    sscanf(&line.at(0), "%ld %lf %lf %lf",&Number,&ap,&ep,&sinip);
    number2pack();
  };

  void print()
  {
    printf("%06ld %20s %10s %5.2lf %5.2lf %7.4lf %7.4lf %7.4lf %7.4lf %7.4lf %7.4lf\n",
	   Number, Designation, pack, H, G, a, e, sini, ap, ep, sinip);
  };
  
  // overloaded = (ASSIGN) operator
  bool operator =(const Asteroid& b)
  {
    Number=b.Number;
    H=b.H;
    G=b.G;
    a=b.a;
    e=b.e;
    sini=b.sini;
    M=b.M;
    omega=b.omega;
    Omega=b.Omega;
    n=b.n;
    Epoch=b.Epoch;
    strcpy(Designation, b.Designation);
    strcpy(pack,b.pack);
    strcpy(EpochPack,b.EpochPack);
    ap=ep=sinip=0;
  };

  // overloaded = (ASSIGN) operator
  bool operator =(const AsteroidPelem& b)
  {
    Number=b.Number;
    H=b.H;
    G=b.G;
    a=b.a;
    e=b.e;
    sini=b.sini;
    M=b.M;
    omega=b.omega;
    Omega=b.Omega;
    n=b.n;
    Epoch=b.Epoch;
    strcpy(Designation, b.Designation);
    strcpy(pack,b.pack);
    strcpy(EpochPack,b.EpochPack);
    ap=b.ap;
    ep=b.ep;
    sinip=b.sinip;
  };
};
